package com.learning.basedao;

import java.util.Collection;
import java.util.List;

import com.learning.querry.Condition;



/**
 * Common DAO specification
 * 
 * @param <T> Type of the class (pojo) being persisted in the database
 * @param <PK> Type of the primary key in the database table.
 */
public interface BaseDao<T, PK> {

	PK save(T value);

    PK save(T value, Collection<String> fields);

    T findById( PK id );
	
	void delete( PK id);
	
	List<T> getAll();
	
	List<T> find(List<Condition> conditions);
	
	/**
	 * Returns the number of records in the table.
	 */
	long count();

    /**
     * Returns the if the persistable object exists in the table.
     */
    boolean exists(T value);

    /*
      * Do we want the following methods or not?
      */
	
	PK create( T value );

    PK create( T value, Collection<String> fields );

    void update( T value );

    void update( T value, Collection<String> fields);

    void populateNewInstance(T value);

    boolean isAutoIncremented();

    boolean isSoftDeleted();
    
    void softDelete(PK id);
}
